//路由封装
import { createRouter, createWebHashHistory } from 'vue-router'
import routes from './routes'
import { getCookie } from '../utils/cookie'
const router = new createRouter({
    history: createWebHashHistory(),
    routes: routes,
    scrollBehavior(to, from, savePosition) {
        if (savePosition) {
            return savePosition;
        }
        return { x: 0, y: 0 }
    }
})

// 守卫
const whiteList = ['/login'];
router.beforeEach((to, from, next) => {
    // 判断是否登录

    next()
})

export default router;